package com.game.pacman.client;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;
import java.net.URL;
import java.util.ArrayList;
import java.util.LinkedList;

import javax.imageio.ImageIO;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class PlayMapScreen_temp extends JPanel implements Runnable{
	private Image image;
	public final int CELL_WIDTH = 25;
	public final int CELL_HEIGHT = 25; 
	
	//벽
	public int[][] wall = {{12,0},{13,0},{1,1},{2,1},{3,1},{4,1},{6,1},{7,1},{8,1},{9,1},{10,1},{12,1},{13,1},{15,1},{16,1},{17,1},{18,1},{19,1},{21,1},{22,1},{23,1},{24,1}
	,{1,2},{2,2},{3,2},{4,2},{6,2},{7,2},{8,2},{9,2},{10,2},{12,2},{13,2},{15,2},{16,2},{17,2},{18,2},{19,2},{21,2},{22,2},{23,2},{24,2}
	,{1,3},{2,3},{3,3},{4,3},{6,3},{7,3},{8,3},{9,3},{10,3},{12,3},{13,3},{15,3},{16,3},{17,3},{18,3},{19,3},{21,3},{22,3},{23,3},{24,3}
	,{1,5},{2,5},{3,5},{4,5},{6,5},{7,5},{9,5},{10,5},{11,5},{12,5},{13,5},{14,5},{15,5},{16,5},{18,5},{19,5},{21,5},{22,5},{23,5},{24,5}
	,{1,6},{2,6},{3,6},{4,6},{6,6},{7,6},{9,6},{10,6},{11,6},{12,6},{13,6},{14,6},{15,6},{16,6},{18,6},{19,6},{21,6},{22,6},{23,6},{24,6}
	,{6,7},{7,7},{18,7},{19,7},{12,7},{13,7}
	,{0,8},{1,8},{2,8},{3,8},{4,8},{6,8},{7,8},{8,8},{9,8},{10,8},{12,8},{13,8},{15,8},{16,8},{17,8},{18,8},{19,8},{21,8},{22,8},{23,8},{24,8},{25,8}
	,{0,9},{1,9},{2,9},{3,9},{4,9},{6,9},{7,9},{8,9},{9,9},{10,9},{12,9},{13,9},{15,9},{16,9},{17,9},{18,9},{19,9},{21,9},{22,9},{23,9},{24,9},{25,9}
	,{0,10},{1,10},{2,10},{3,10},{4,10},{6,10},{7,10},{18,10},{19,10},{21,10},{22,10},{23,10},{24,10},{25,10}
	,{0,11},{1,11},{2,11},{3,11},{4,11},{6,11},{7,11},{18,11},{19,11},{21,11},{22,11},{23,11},{24,11},{25,11}
	,{0,12},{1,12},{2,12},{3,12},{4,12},{6,12},{7,12},{18,12},{19,12},{21,12},{22,12},{23,12},{24,12},{25,12}
	,{0,13},{1,13},{2,13},{3,13},{4,13},{21,13},{22,13},{23,13},{24,13},{25,13}
	,{0,14},{1,14},{2,14},{3,14},{4,14},{6,14},{7,14},{18,14},{19,14},{21,14},{22,14},{23,14},{24,14},{25,14}
	,{0,15},{1,15},{2,15},{3,15},{4,15},{6,15},{7,15},{18,15},{19,15},{21,15},{22,15},{23,15},{24,15},{25,15}
	,{0,16},{1,16},{2,16},{3,16},{4,16},{6,16},{7,16},{18,16},{19,16},{21,16},{22,16},{23,16},{24,16},{25,16}
	,{0,17},{1,17},{2,17},{3,17},{4,17},{6,17},{7,17},{9,17},{10,17},{11,17},{12,17},{13,17},{14,17},{15,17},{16,17},{18,17},{19,17},{21,17},{22,17},{23,17},{24,17},{25,17}
	,{0,18},{1,18},{2,18},{3,18},{4,18},{6,18},{7,18},{9,18},{10,18},{11,18},{12,18},{13,18},{14,18},{15,18},{16,18},{18,18},{19,18},{18,18},{19,18},{21,18},{22,18},{23,18},{24,18},{25,18}
	,{12,19},{13,19}
	,{1,20},{2,20},{3,20},{4,20},{6,20},{7,20},{8,20},{9,20},{10,20},{12,20},{13,20},{15,20},{16,20},{17,20},{18,20},{19,20},{21,20},{22,20},{23,20},{24,20}
	,{1,21},{2,21},{3,21},{4,21},{6,21},{7,21},{8,21},{9,21},{10,21},{12,21},{13,21},{15,21},{16,21},{17,21},{18,21},{19,21},{21,21},{22,21},{23,21},{24,21}
	,{3,22},{4,22},{21,22},{22,22}
	,{0,23},{1,23},{3,23},{4,23},{6,23},{7,23},{9,23},{10,23},{11,23},{12,23},{13,23},{14,23},{15,23},{16,23},{18,23},{19,23},{21,23},{22,23},{24,23},{25,23}
	,{0,24},{1,24},{3,24},{4,24},{6,24},{7,24},{9,24},{10,24},{11,24},{12,24},{13,24},{14,24},{15,24},{16,24},{18,24},{19,24},{21,24},{22,24},{24,24},{25,24}
	,{6,25},{7,25},{12,25},{13,25},{18,25},{19,25}
	,{1,26},{2,26},{3,26},{4,26},{5,26},{6,26},{7,26},{8,26},{9,26},{10,26},{12,26},{13,26},{15,26},{16,26},{17,26},{18,26},{19,26},{20,26},{21,26},{22,26},{23,26},{24,26}
	,{1,27},{2,27},{3,27},{4,27},{5,27},{6,27},{7,27},{8,27},{9,27},{10,27},{12,27},{13,27},{15,27},{16,27},{17,27},{18,27},{19,27},{20,27},{21,27},{22,27},{23,27},{24,27}
	};
	
	public PlayMapScreen_temp(){
		setLayout(null);
		setBackground(Color.BLACK);
		setDoubleBuffered(true);
		setBounds(Constants.BUTTON_WIDTH,0,Constants.MAP_WIDTH,Constants.MAP_HEIGHT);
		
		try{
			URL url = getClass().getResource("/1.jpg");
			Image originalImage = ImageIO.read(url);
			image = originalImage.getScaledInstance(CELL_WIDTH, CELL_HEIGHT,Image.SCALE_SMOOTH);
		}catch(Exception e){
			
		}
		startGame();
	}
	
	public void startGame(){
		
		Thread thread = new Thread(this);
		thread.start();
	}

	@Override
	public void run() {
		// TODO Auto-generated method stub
			repaint();
			//프레임 간격 처리 
			//-> 일정한 시간 동안 멈추게 해서 다음 프레임이
			//   처리되는 간격을 조정 (값이 적을 수록 빠르게 화면 갱신)
			try {
				Thread.sleep(25);
			} catch (Exception ex) {}
	}
	
	@Override
	public void paint(Graphics arg0) {
		// TODO Auto-generated method stub
		super.paint(arg0);
		for(int i = 0; i<wall.length; i++){
			arg0.drawImage(image, 
			wall[i][0]*CELL_WIDTH, wall[i][1]*CELL_WIDTH, 
			CELL_WIDTH, CELL_HEIGHT, this);
		}
	}

	public int[][] getWall() {
		return wall;
	}

	public void setWall(int[][] wall) {
		this.wall = wall;
	}
}
